package edu.pku.group6.dao;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;

public class HibernateUtil {
	
	public static void save(Object obj){
		try{
			SessionFactory sf = new Configuration().configure().buildSessionFactory();
			Session session = sf.openSession();
			Transaction tx = session.beginTransaction();
			session.saveOrUpdate(obj);
			tx.commit();
			session.close();
		}
		catch(Exception e){
			e.printStackTrace();
		}
	}
	
}
